[Latex]多子图时图注添加括号/引用子图添加括号

您所在的位置:网站首页 引用 括号 [Latex]多子图时图注添加括号/引用子图添加括号

[Latex]多子图时图注添加括号/引用子图添加括号

2024-07-02 19:11| 来源: 网络整理| 查看: 265

问题

latex默认的图注里,子图没有括号,只有a,b

解决方法 方法1 在导言区(就是\begin{document}这句话之前),添加指令: \DeclareCaptionLabelFormat{custom}{#1(#2)}

解释:

就是声明一个全局关键字LabelFormat,表示图标题的写法#1(#2) 就是**图1(子图2)**的意思 然后在正文里每个子图部分,声明\caption前,都要用上面这句强调一下是括号版图注,如下 \begin{figure*}[!t] \begin{subfigure}{\linewidth} \centering \includegraphics[width=\linewidth]{figures/chapter3/Vis1} \captionsetup{labelformat=custom} \caption{Vis1} \label{fig:Vis1} \end{subfigure} \begin{subfigure}{\linewidth} \centering \includegraphics[width=\linewidth]{figures/chapter3/Vis2} \captionsetup{labelformat=custom} \caption{Vis2} \label{fig:Vis2} \end{subfigure} \caption{可视化。(a) Vis1; (b) Vis2} \label{fig:Visual} \end{figure*}

**注意:**这个方法只能让图注的子图添加括号,但是引用子图(\ref{fig:Vis2})的话,仍然不会出现括号!需要用下面这个方法才能一劳永逸!

方法2 和上面类似,直接在导言区声明指令: \renewcommand\thesubfigure{(\alph{subfigure})} \captionsetup[sub]{ labelformat=simple }

结束!第二种方法最推荐,既可以写图注时子图添加括号,还会在引用时就会自动用括号了。

效果展示

在这里插入图片描述 在这里插入图片描述



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3